{% extends 'base.html' %}

{% block content %}
    {% if diagnostic_tests %}
        <table class="table table-striped table-condensed table-hover">
            <tr>
                <th>Title</th>
                <th>Edit</th>
				<th>Trash</th>
				<th>Active</th>
				<th></th>
            </tr>
            {% for diagnostic in diagnostic_tests %}
                {% if diagnostic = active %}
				<tr class="info">
				{% else %}
				<tr>
				{% endif %}
                    <td>{{ diagnostic.title }}</a></td>
                    <td><a href="{{ diagnostic.get_absolute_url }}"><i class="icon-edit"></i></a></td>
					</td>
					<td>
					<form id="set_active" method="POST" action="{% url 'test.views.trash_diagnostic_test' %}">
					{% csrf_token %}
					<input type="hidden" name="diagnostic_test" value="{{ diagnostic.id }}">
					<a href='#' onclick='this.parentNode.submit(); return false;'><i class="icon-trash"></i></a>	
					</form>
					</td>
					{% if diagnostic = active %}
					<td>
					Yes
					</td>
					<td>
					<form id="set_active" method="POST" action="{% url 'test.views.list_diagnostic_tests' %}">
					{% csrf_token %}
					<input type="hidden" name="diagnostic_test" value="{{ diagnostic.id }}">
					<button id="submit" class="btn-mini btn-primary">Set as active</button>	
					</form>
					</td>
					{% else %}
					<td>
					No
					</td>
					<td>
					<form id="set_active" method="POST" action="{% url 'test.views.list_diagnostic_tests' %}">
					{% csrf_token %}
					<input type="hidden" name="diagnostic_test" value="{{ diagnostic.id }}">
					<button id="submit" class="btn-mini btn-primary">Set as active</button>	
					</form>
					</td>
					{% endif %}
					
					
					</tr>
            {% endfor %}
        </table>
    {% else %}
        <p>There are no diagnostic tests in the database.</p>
    {% endif %}
	<a href="{% url 'test.views.create_diagnostic_test' %}" class="btn btn-primary" type="button">
						<i class="icon-plus icon-white"></i> Add diagnostic test
	</a>
{% endblock %}